<ion-header>

  <ion-navbar>
    <ion-buttons>
      <button class="font_size_standard" ion-button icon-only (click)="push('ManagerOrderSearchPage',{'status':status})"
              *ngIf="!navParams.get('isSearching')">
        <ion-icon name="search"></ion-icon>
      </button>
    </ion-buttons>

    <ion-title>
      <span (click)="changeOrderStatus($event)">{{status.VALUE}}({{datasNum}})
        <i class="fa fa-angle-down ml5"></i>  </span>
    </ion-title>

    <ion-buttons end>
      <button class="font_size_large ml20" ion-button icon-only (click)="push('ManagerOrderDispatchPage',param)"
              *ngIf="status.KEY=='DPG'">批量派工
      </button>
    </ion-buttons>
  </ion-navbar>

</ion-header>

<ion-content (ionScroll)="scrollContent()">
  <ion-refresher (ionRefresh)="refresh($event)" pullMax="300" [enabled]="IS_APP">
    <ion-refresher-content
      pullingText="下拉刷新"
      refreshingSpinner="circles"
      refreshingText="正在刷新...">
    </ion-refresher-content>
  </ion-refresher>
  <ion-list>
    <div class="w12 font_size_large bgcolor_white mb10" *ngFor="let data of datas; let i = index">
      <ion-item (click)="data.GDLC=status.KEY;push('ManagerOrderDetailPage',data);$event.stopPropagation();">
        <ion-label class="text_hide_none font_size_large">
          <div class="w12 font_weight_bold">
            <span class="font_white  font_size_standard bgcolor_blue plr5 mr5 lh20">{{data.DESCRIPTION}}</span>
            <i class="fa fa-map-marker mr5" style="color:#347eff;"></i>{{data.ADDRESS}}
          </div>
          <span class="w08 mt5">{{data.NAME}} / {{data.MOBILE}}</span>
          <span class="w04 mt5 fr tr font_gray">{{data.DISTANCE!='0'?(data.DISTANCE|distance):''}}</span>
          <span class="w08 mt5">{{data.ID}}</span>
          <span class="w04 mt5 fr tr font_gray font_size_standard">{{data.THRUTIME}}  {{data.YYSJD}}</span>
          <span class="w06 mt5 font_black_666" *ngIf="data.GDLY">订单来源:{{data.GDLY}}</span>
          <span class="w06 mt5 fr tr font_red" *ngIf="data.ZT">{{data.ZT}}</span>
          <span class="w12 mt5 font_black_666">{{data.ORDERID}}</span>
          <span class="w12 mt5 font_black_666 font_size_standard">备注:{{data.BZ?data.BZ:'无'}}</span>
        </ion-label>
      </ion-item>
      <ion-item *ngFor="let pro of data.CSM_SORDERITEM">
        <ion-label class="mt10 mb10 text_hide_none">
          <span class="w10">{{pro.EXTSKUNAME}}</span>
          <span class="w02 tr font_gray">× {{pro.NUM}}</span>
          <!--<span class="w02 tr " [class.font_gray]="pro.JDBJ==1" [class.font_red]="pro.JDBJ!=1">{{pro.JDBJ==1?'已装车':'未装车'}}</span>-->
        </ion-label>
      </ion-item>
      <div class="w12 rse_list_btn">
        <ng-container *ngIf="status.KEY=='DPG'">
          <button clear (click)="dispatch(data,i);$event.stopPropagation();">派单</button>
          <button clear (click)="grabOrders(data,i);$event.stopPropagation();" [disabled]="data.STATUSID == 'GRABED'">
            抢单派工
          </button>
        </ng-container>
        <!--<ng-container *ngIf="status.KEY=='ALL'">
          <button clear (click)="push('ChatPage');$event.stopPropagation();">联系客服</button>
        </ng-container>-->
      </div>
    </div>

    <div *ngIf="datasConfig.isEnd==true" class="w12 mt20 mb20 tc font_gray">
      ------------------------ 已经到底了 ------------------------
    </div>
    <ion-infinite-scroll (ionInfinite)="getMoreDatas($event)" threshold="100px" [enabled]="!datasConfig.isEnd">
      <ion-infinite-scroll-content loadingSpinner="bubbles" loadingText="数据加载中...">
      </ion-infinite-scroll-content>
    </ion-infinite-scroll>
  </ion-list>
  <ion-fab bottom right mode="ios" *ngIf="canScrollToTop">
    <button ion-fab mini color="light" mode="ios" (click)="content.scrollToTop();$event.stopPropagation();">
      <ion-icon name="md-arrow-round-up"></ion-icon>
    </button>
  </ion-fab>
</ion-content>
